package com.example.handler;

import com.example.exception.BaseException;
import com.example.vo.Result;
import com.example.vo.ResultCode;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Program: ishop
 * @ClassName: GlobalExceptionHandler
 * @Description:  全局自定义异常处理器
 **/
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BaseException.class)
    public Result loginFail(BaseException exception){
        return Result.error(ResultCode.CLIENT_A0212,exception.getMessage());
    }
}